/**
 * 添加或者修改页面
 */
var TaskInfoDlg = {
    data: {
        plotData: "",
        startData: "",
        predictData: "",
        actualData: "",
        jiaodian: "",
    }
};

layui.use(['form', 'admin', 'ax', 'laydate', 'upload'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var laydate = layui.laydate;
    var upload = layui.upload;

    //出图时间选择框
    laydate.render({
        elem: '#plotData',
        tiger: 'click',
    });

    //开工时间选择框
    laydate.render({
        elem: '#startData',
        tiger: 'click',
    });

    //预估完工时间选择框
    laydate.render({
        elem: '#predictData',
        tiger: 'click',
    });

    //实际时间选择框
    laydate.render({
        elem: '#actualData',
        tiger: 'click',
    });

    //交店时间选择框
    laydate.render({
        elem: '#jiaodian',
        tiger: 'click',
    });

    //让当前iframe弹层高度适应
    admin.iframeAuto();

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/task/addRent", function (data) {
            Feng.success("添加成功！");
            window.location.href = Feng.ctxPath + '/project'
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

    //现场踏勘
    $("#scouting").click(function (data) {
        window.location.href = Feng.ctxPath + '/project/premises?=' + data.id;
    });

    //返回按钮
    $("#backupPage").click(function () {
        window.location.href = Feng.ctxPath + '/project'
    });
});